// 调试 函数结合
// NEVER SAY DIE ->  never-say-die

const _ = require('lodash')

const split = _.curry((sep, str) => _.split(str, sep))


const join = _.curry((sep, array) => _.join(array, sep))

// const log = v => { 
//   console.log(v);
//   return v
// }

const trace = _.curry((tep, v) => { 
  console.log(tep, v);
  return v
})

const map = _.curry((fn, array) => _.map(array, fn))

const f = _.flowRight(join('-'), trace('map 之后'), map(_.toLower), trace('split 之后'), split(' '))

console.log(f('NEVER SAY DIE')) 
// split 之后 [ 'NEVER', 'SAY', 'DIE' ]
// map 之后 [ 'never', 'say', 'die' ]
// never-say-die